package com.winshare.saleAssistant.util;

import com.winshare.saleAssistant.domain.entity.SysParamDO;
import com.winshare.saleAssistant.service.RedisService;
import com.winshare.saleAssistant.service.SysParamService;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
public class ParamCacheUtils {

    private final SysParamService sysParamService;

    private final RedisService redisService;

    public ParamCacheUtils(SysParamService sysParamService, RedisService redisService) {
        this.sysParamService = sysParamService;
        this.redisService = redisService;
    }

    @PostConstruct
    public void init() {
        SysParamDO sysParamDO = sysParamService.getSysParam();
        redisService.saveSysParam(sysParamDO);
    }
}
